package com.coolingme.client;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

/**
 * ElasticSearch 客户端测试
 *
 * @author wangyue
 * @date 2021/7/26 15:29
 */
public class ESClient {

    public static void main(String[] args) {
        // 创建ES客户端
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(new HttpHost("127.0.0.1", 9200)));

        System.out.println(client);
        try {
            // 关闭客户端
            client.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
